package com.sumainfor.pc.gmio.controller.housekeeper;

import com.sumainfor.common.util.JsonResult;
import com.sumainfor.common.utlis.PageUtils;
import com.sumainfor.common.utlis.Pager;
import com.sumainfor.pc.gmio.service.HoLivecardService;
import com.sumainfor.pc.gmio.service.HoTenantBlaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 *服务管家居住证
 */
@RestController
@RequestMapping("/housekeeper/HoLivecard")
public class HoLivecardController implements Serializable {

    @Autowired
    private HoLivecardService hoLivecardService;

    /**
     * 查询居住证列表
     */
    @GetMapping("/getHoLivecardList")
    public JsonResult getHouInfoListForEwg(@RequestParam Map<String,Object>params, Pager pager){
        JsonResult result=new JsonResult();
        pager.setPagerNecessary(params, pager);
        PageUtils pageUtils = new PageUtils();
        Integer cout=hoLivecardService.getHoLivecardListCount(params);
        if(cout==0){
            return pageUtils.getJsonResult(new ArrayList<Map<String,Object>>(), params,cout);
        }
        List<Map<String,Object>> getCommunityList=hoLivecardService.getHoLivecardList(params);
        result=pageUtils.getJsonResult(getCommunityList, params, cout);
        return result;
    }

    /**
     * 办理居住证
     */
    @PostMapping("/updateHoLivecard")
    public JsonResult updateHoLivecard(@RequestBody Map<String,Object>params){
        return hoLivecardService.updateHoLivecard(params);
    }
}
